<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>文件预览</title>
    <script src="js/jQuery3.6.1.js"></script>
    <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/js-base64@3.6.0/base64.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/4.0.0/crypto-js.min.js"></script>
</head>
<body>
<div >
    <a onclick="openWord(1)">预览word</a><br>
    <a onclick="openWord(2)">预览excel</a><br>
    <a onclick="openWord(3)">预览txt</a><br>
    <a onclick="openWord(4)">预览pdf</a><br>
    <a onclick="openWord(5)">预览png</a><br>
    <a onclick="openWord(6)">预览md</a><br>
    <a onclick="openWord(7)">预览导入模版excel</a><br>
    <a onclick="openWord(8)">预览开发手册word</a><br>
</div>

</body>
<script>
    // 文件上传
    function openWord(type) {
        var name = "";
        switch (type){
            case 1: name="file.docx";break;
            case 2: name="file.xlsx";break;
            case 3: name="file.txt";break;
            case 4: name="file.pdf";break;
            case 5: name="file.png";break;
            case 6: name="file.md";break;
            case 7: name="入表资产导入模版.xlsx";break;
            case 8: name="Java开发手册-数据宝.docx";break;
        }
        var url = 'http://192.168.10.207:9000/cdm/upload/20240307/'+name; //要预览文件的访问地址
        // 192.168.10.101 本机Ip
        window.open('http://192.168.10.207:8012/onlinePreview?url='+encodeURIComponent(Base64.encode(url)));
    }

</script>
</html>